# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=libkdegames
pkgver=22.04.3
pkgrel=0
# armhf blocked by qt5-qtdeclarative
# s390x and riscv64 blocked by polkit
arch="all !armhf !s390x !riscv64"
url="https://kde.org/applications/games"
pkgdesc="Common code and data for many KDE games"
license="LGPL-2.0-only AND GFDL-1.2-only"
makedepends="
	extra-cmake-modules
	karchive-dev
	kbookmarks-dev
	kcodecs-dev
	kcompletion-dev
	kconfig-dev
	kconfigwidgets-dev
	kcoreaddons-dev
	kcrash-dev
	kdbusaddons-dev
	kdeclarative-dev
	kdnssd-dev
	kglobalaccel-dev
	kguiaddons-dev
	ki18n-dev
	kiconthemes-dev
	kitemviews-dev
	kjobwidgets-dev
	knewstuff-dev
	kservice-dev
	ktextwidgets-dev
	kwidgetsaddons-dev
	kxmlgui-dev
	libsndfile-dev
	openal-soft-dev
	qt5-qtbase-dev
	qt5-qtdeclarative-dev
	qt5-qtsvg-dev
	samurai
	"
checkdepends="xvfb-run"
source="https://download.kde.org/stable/release-service/$pkgver/src/libkdegames-$pkgver.tar.xz"
subpackages="$pkgname-dev $pkgname-lang carddecks::noarch"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE xvfb-run ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

carddecks() {
	pkgdesc="Contains all carddecks for KDE cardgames"
	depends="$pkgname"

	amove usr/share/carddecks
}

sha512sums="
f884b6badab7dbe4050a620429441acb10c53766ca9aec16469d9a981964e8456119afc09a52779961f9f6651769ebefdcc1ca5979b2bd92e3546136f8c4f5a0  libkdegames-22.04.3.tar.xz
"
